<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
	"http://www.springframework.org/dtd/spring-beans.dtd">

<!--
	Name der Konfigurationsdatei (für Dispatcher) wird durch Name des 
	Dispatchers aus web.xml festgelegt und mit 
	"-servlet.xml" erweitert -> springapp-servlet.xml.
-->

<beans>
	<!-- Ersetzt in web.xml durch contextConfigLocation
	<import resource="classpath:spring-beans.xml"/>
	 -->

	<!--  Validator  -->
    <bean id="neuValidator" class="de.kiltz.foo.mvc.NeuValidator"/>
    
	<!-- Controller -->    
    <bean id="neuController" class="de.kiltz.foo.mvc.NeuController">
        <property name="sessionForm" value="false"/>
        <property name="commandName" value="eintragen"/>
        <property name="commandClass" value="de.kiltz.foo.domain.Foo"/>
        <property name="validator" ref="neuValidator"/>
        <property name="formView" value="neu"/>
        <property name="successView" value="redirect:liste.html"/>
		<property name="fooService" ref="fooService" />
    </bean>	

    <bean id="listeController" class="de.kiltz.foo.mvc.ListeController">
        <property name="sessionForm" value="true"/>
        <property name="commandName" value="listeAuswahl"/>
        <property name="commandClass" value="de.kiltz.foo.mvc.ListeForm"/>
        <property name="formView" value="liste"/>
        <property name="successView" value="liste"/>
		<property name="fooService" ref="fooService" />
		
    </bean>	
    <bean id="detailController" class="de.kiltz.foo.mvc.DetailController">
		<property name="fooService" ref="fooService" />
    </bean>	

	<bean id="startController"
		class="de.kiltz.foo.mvc.StartController">
	</bean>

	<!-- Messagebundle -->
	<bean id="messageSource"
		class="org.springframework.context.support.ResourceBundleMessageSource">
		<property name="basename">
			<value>messages</value>
		</property>
	</bean>


	<bean id="urlMapping"
		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
		<property name="mappings">
			<props>
				<prop key="/start.html">startController</prop>
				<prop key="/liste.html">listeController</prop>
				<prop key="/neu.html">neuController</prop>
				<prop key="/detail.html">detailController</prop>
			</props>
		</property>
	</bean>
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass">
			<value>org.springframework.web.servlet.view.JstlView</value>
		</property>
		<property name="prefix">
			<value>/WEB-INF/jsp/</value>
		</property>
		<property name="suffix">
			<value>.jsp</value>
		</property>
	</bean>
</beans>